<template>
	<view class="myheader">
		<van-nav-bar
		  left-arrow
		  fixed
		  @click-left="goBack"
		>
		 <van-dropdown-menu class="setIndex" active-color="#000"  slot="title">
			<van-dropdown-item  @change="changePage" :value="currentIndex" :options="option" />
		  </van-dropdown-menu>
		
		</van-nav-bar>
       
	

		
	</view>
</template>

<script>
	export default {
		name:"myheader",
		data() {
			return {
				  currentIndex: '',
				  option: [
				      { text: '1.基本信息', value: 0, url: '/subPublishHouse/baseInfo/setHouseInfo?houseId' },
				      { text: '2.设施服务', value: 1, url: '/subPublishHouse/device/index?houseId' },
				      { text: '3.房屋价格', value: 2, url: '/subPublishHouse/setPrice/index?houseId' },
					  { text: '4.入住须知', value: 3, url: '/subPublishHouse/notice/setCheckIn?houseId'  },
				    ]
			};
		},
		mounted() {
		},
		methods: {
			setHeaderIndex(index) {
				this.currentIndex = index;
			},
 			goBack() {
				const _this = this
				uni.navigateBack({
					delta:1,
					success: function() {
						_this.reloadPage()
					}
				});
			},
			reloadPage() {
			  // 页面重载
			          const pages = getCurrentPages()
			          // 声明一个pages使用getCurrentPages方法
			          const curPage = pages[pages.length - 1]
			          // 声明一个当前页面
			          curPage.onLoad(curPage.options) // 传入参数
			          curPage.onShow()
			          curPage.onReady()
			
			},
			  changePage(e) {
				  let  houseId =this.$getStorage('houseId');
				  this.currentIndex = e.detail;
				  this.$goPage(1, this.option[e.detail].url + houseId);
				  
			  }
		}
	
	}
</script>

<style>
	.myheader {
		position: relative;
		z-index: 99;
		margin-bottom: 150rpx;
	}
	.setIndex {
		position: relative;
		z-index: 9999999!important;
	}

</style>